﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OConf.Entity
{
    public class ConfigInfoEntity
    {
        /// <summary>
        /// id
        /// </summary>
        [Key, Column(TypeName = "varchar(50)"), Required, MaxLength(50)]
        public string ID { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        [Column(TypeName = "varchar(50)"), Required, MaxLength(50)]
        public string ProjectID { get; set; }

        /// <summary>
        /// 命名空间
        /// </summary>
        [Column(TypeName = "varchar(50)"), MaxLength(50)]
        public string NameSpaceID { get; set; }

        /// <summary>
        /// 配置key
        /// </summary>
        [Column(TypeName = "varchar(50)"), Required, MaxLength(50)]
        public string ConfigKey { get; set; }

        /// <summary>
        /// 配置value
        /// </summary>
        [Column(TypeName = "varchar(300)"), Required, MaxLength(300)]
        public string ConfigValue { get; set; }

        /// <summary>
        /// 配置描述
        /// </summary>
        [Column(TypeName = "varchar(200)"), MaxLength(200)]
        public string ConfigDescription { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column(TypeName = "datetime"), Required]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 发布状态（1.已发布；2.增；3.删；4.改；）
        /// </summary>
        [DefaultValue(1), Column(TypeName = "int"), Required]
        public int State { get; set; }
    }

    /// <summary>
    /// 配置信息发布状态
    /// </summary>
    public enum ConfigInfoState
    {
        已发布 = 1,
        增 = 2,
        删 = 3,
        改 = 4
    }
}
